/*
 * BlockedQ.h
 *
 *  Created on: 2013-11-12
 *      Author: jmes
 */

#ifndef BLOCKEDQ_H_
#define BLOCKEDQ_H_

#include "Process.h"
#include <stdio.h>
#include <list>
#include <queue>
#include <pthread.h>

class BlockedQ {
public:
	void add(Process* p);
	virtual ~BlockedQ();
	static BlockedQ* getInstance();
	void tick();
	void resetPriorityRuntime();

private:
	void removeProcessFromQ(Process* p);
	std::list<Process*> queue;
	static BlockedQ* instance;
	void checkForFinishedOperations();
	void decrementTimeOnOperations();
	BlockedQ();
	pthread_cond_t cond;
	pthread_mutex_t mutex;
};

#endif /* BLOCKEDQ_H_ */
